package cat.sun.activities;

import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import cat.sun.R;
import cat.sun.dialogs.DialogPlay;
import cat.sun.dialogs.LeaderboardsDialog;
import cat.sun.dialogs.SettingsDialog;
import cat.sun.dialogs.ThemesDialog;

public class Main extends FragmentActivity implements OnClickListener {
	public static final String VIBRATION = "Vibration";
	public static final String HIGH_DEF = "HighDefinition";
	public static final String ZOOM = "Zoom";
	public static final String OPTIONS = "Options";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);

		setContentView(R.layout.main);

		LinearLayout play = (LinearLayout) findViewById(R.id.main_play_layout);
		LinearLayout leader = (LinearLayout) findViewById(R.id.main_leader_layout);
		LinearLayout themes = (LinearLayout) findViewById(R.id.main_themes_layout);
		LinearLayout settings = (LinearLayout) findViewById(R.id.main_options_layout);
		play.setOnClickListener(this);
		leader.setOnClickListener(this);
		themes.setOnClickListener(this);
		settings.setOnClickListener(this);
		TextView playTxt = (TextView) findViewById(R.id.main_text_play);
		TextView leaderTxt = (TextView) findViewById(R.id.main_text_leader);
		TextView themesTxt = (TextView) findViewById(R.id.main_text_skins);
		TextView settingsTxt = (TextView) findViewById(R.id.main_text_settings);

		playTxt.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Black.ttf"));
		leaderTxt.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Black.ttf"));
		themesTxt.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Black.ttf"));
		settingsTxt.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Black.ttf"));
		
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.main_play_layout:
			DialogPlay playDialog = DialogPlay.newInstance();
			playDialog.show(getSupportFragmentManager(), "play_dialog");
			break;

		case R.id.main_leader_layout:
			LeaderboardsDialog leaderboardsDialog = LeaderboardsDialog
					.newInstance();
			leaderboardsDialog.show(getSupportFragmentManager(),
					"leaderboarsds_dialog");
			break;
		case R.id.main_themes_layout:
			ThemesDialog themesDialog = ThemesDialog.newInstance();
			themesDialog.show(getSupportFragmentManager(), "themes_dialog");
			break;
		case R.id.main_options_layout:
			SettingsDialog settingsDialog = SettingsDialog.newInstance();
			settingsDialog.show(getSupportFragmentManager(), "settings_dialog");
			break;
		}
	}
}